package edu.neusoft.yuejian_09.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import edu.neusoft.yuejian_09.R;
import it.sephiroth.android.library.picasso.Picasso;

import static edu.neusoft.yuejian_09.base.Constant.CLUB_PHOTO_URL;

/**
 * Created by Administrator on 2017/10/19.
 */

public class ClubDetailActivity extends AppCompatActivity {
    private ImageView left;
    private ImageView collect;
    private ImageView c_pic;
    private TextView c_name;
    private TextView c_address;
    private TextView c_time;
    private TextView c_info;
    private TextView c_phone;
    private String club_id;
    private int flag;
    private String club_name;
    private String club_pic;
    private String club_address;
    private String club_time;
    private Button activity_club,course_club,video_club;
    private Context mContex;
    private List mDataList;
    private LayoutInflater mLayoutInflater;
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_club_info);
        initView();
        getClubData();
        initEvent();

        // isBeCollected();
    }


    private void initView() {

        collect = (ImageView) findViewById(R.id.collect);
        left = (ImageView) findViewById(R.id.left);
        c_name = (TextView) findViewById(R.id.club_name);
        c_address = (TextView) findViewById(R.id.club_address);
        c_time = (TextView) findViewById(R.id.club_time);
        c_info = (TextView) findViewById(R.id.club_info);
        c_phone = (TextView) findViewById(R.id.club_phone);
        c_pic = (ImageView) findViewById(R.id.club_pic);

        activity_club = (Button) findViewById(R.id.activity_club);
        course_club = (Button) findViewById(R.id.course_club);
        video_club = (Button) findViewById(R.id.video_club);

    }

    private void initEvent(){
        final Bundle bundle = this.getIntent().getExtras();
        club_id=bundle.getString("club_id");
        System.out.print(club_id);


        left.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        activity_club.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(ClubDetailActivity.this,ClubActActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });


        course_club.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ClubDetailActivity.this,ClubTrainActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
        video_club.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ClubDetailActivity.this,ClubVideoActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("club_id", club_id);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

    }
    private void getClubData() {
        Bundle bundle = this.getIntent().getExtras();
        //int cid=bundle.getInt("c_id");
        //System.out.print(cid);
        String club_name = bundle.getString("club_name");
        String club_address = bundle.getString("club_address");
        String club_phone = bundle.getString("club_phone");
        String club_info = bundle.getString("club_intro");
        // int tprice = bundle.getInt("t_price");
        String club_pic = CLUB_PHOTO_URL + bundle.getString("club_pic");
        String club_time = bundle.getString("club_time");
        c_name.setText(club_name);
        c_address.setText(club_address);
        c_phone.setText(club_phone);
        c_info.setText(club_info);
        c_time.setText(club_time);
        Picasso.with(this).load(club_pic).into(c_pic);

    }
}

